import math
import random

import embetant

#----------------------------------------------------
def LotkaVolterra (t, v, *, a=0.8, b=0.1, c=0.4, d=0.1):

    x, y = v[0], v[1]
    x_dot = (a * x - b * x * y)
    y_dot = -c * y + d * x * y

    return [x_dot, y_dot]

#----------------------------------------------------
def LotkaVolterraModif (t, v, *, a=0.8, b=0.1, c=0.4, d=0.1):

    x, y = v[0], v[1]
    x_dot = (a * x - b * x * y)
    y_dot = -c * y + d * x * y + \
            0.125 * math.sin(math.pi * t / 2000.) 

    return [x_dot, y_dot]

#----------------------------------------------------
def LotkaVolterraPID (t, v, *, a=0.8, b=0.1, c=0.4, d=0.1):

    x, y = v[0], v[1]
    x_dot = (a * x - b * x * y)
    y_dot = -c * y + d * x * y - embetant.Ghistoryctrl[round(t)]

    return [x_dot, y_dot]


